#include<stdio.h>
int removeDuplicates(int* nums, int numsSize) {     	 	   
    if (numsSize == 0) return 0;
    int offset = 0, i, pre = nums[0];

    for (i = 1 ; i < numsSize ; i++) {     	 	   
        if (nums[i] == pre) {     	 	   
            offset++;
        } else {     	 	   
            pre = nums[i];
            nums[i-offset] = nums[i];
        }
    }
    return numsSize - offset;
}     	 	   
int main(int argc, char **argv)
{     	 	   

    int * array;
    printf("Please input the arraysize\n");
    int n,i;
    scanf("%d",&n);
    array = (int*)malloc(sizeof(int)*n);
    for(i=0; i < n; i++)
    {     	 	   
        printf("Please input the %d-th number\n",i);
        scanf("%d",&array[i]);
    }


    int result = removeDuplicates(array, n);
    printf("values are %d\n", result);
    for (  i = 0; i < result; ++i)
    {     	 	   
        printf("%d\n", array[i]);
    }


}     	 